@extends('Admin.layout.layout')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>结算管理</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="input-group fl mr10 mb5">
                                    <input type="text" placeholder="付款方/订单编号/收款方" class="input-sm form-control">
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <select class="form-control selecth30" name="account">
                                        <option>状态</option>
                                        <option>选项 1</option>
                                        <option>选项 2</option>
                                        <option>选项 3</option>
                                        <option>选项 4</option>
                                    </select>
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <input placeholder="开始日期" class="input-sm form-control layer-date" id="start">
                                </div>
                                <div class="input-group fl mr10 mb5"><p class="form-control-static">至</p></div>
                                <div class="input-group fl mr10 mb5">
                                    <input placeholder="结束日期" class="input-sm form-control layer-date" id="end">
                                </div>
                                <button type="button" class="btn btn-sm btn-primary fl mb5">查询</button>
                            </div>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable" id="editable">
                            <thead>
                                <tr>
                                    <th width="150">订单号码</th>
                                    <th>类型</th>
                                    <th>支付日期</th>
                                    <th>付款方</th>
                                    <th>收款方</th>
                                    <th>金额</th>
                                    <th>状态</th>
                                    <th>备注</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="no-records-found center"><td colspan="8">没有找到匹配的记录</td></tr>
                                <tr>
                                    <td>20170711023719238322</td>
                                    <td>下单</td>
                                    <td>2017/09/26</td>
                                    <td>张三五</td>
                                    <td>奥策平台</td>
                                    <td class="text-danger">+433.00</td>
                                    <td>转入</td>
                                    <td>待转入卖家XXX</td>
                                </tr>
                                <tr>
                                    <td>20170711023719238322</td>
                                    <td>签收</td>
                                    <td>2017/09/26</td>
                                    <td>张三五</td>
                                    <td>奥策平台</td>
                                    <td class="text-danger">-433.00</td>
                                    <td>转出</td>
                                    <td>待转入卖家XXX</td>
                                </tr>
                                <tr>
                                    <td>20170711023719238322</td>
                                    <td>下单</td>
                                    <td>2017/09/26</td>
                                    <td>张三五</td>
                                    <td>奥策平台</td>
                                    <td class="text-danger">+433.00</td>
                                    <td>退款</td>
                                    <td>待转入卖家XXX</td>
                                </tr>
                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-sm-6">
                                <h4 class="form-control-static">合计：<font class="text-danger">6000.00</font></h4>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
                                    <ul class="pagination">
                                        <li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
                                            <a href="#">上一页</a>
                                        </li>
                                        <li class="paginate_button " aria-controls="editable" tabindex="0">
                                            <a href="#">1</a>
                                        </li>
                                        <li class="paginate_button " aria-controls="editable" tabindex="0">
                                            <a href="#">2</a>
                                        </li>
                                        <li class="paginate_button " aria-controls="editable" tabindex="0">
                                            <a href="#">3</a>
                                        </li>
                                        <li class="paginate_button active" aria-controls="editable" tabindex="0">
                                            <a href="#">4</a>
                                        </li>
                                        <li class="paginate_button " aria-controls="editable" tabindex="0">
                                            <a href="#">5</a>
                                        </li>
                                        <li class="paginate_button " aria-controls="editable" tabindex="0">
                                            <a href="#">6</a>
                                        </li>
                                        <li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
                                            <a href="#">下一页</a>
                                        </li>
                                        <li>&nbsp;&nbsp;共437页，到第&nbsp;&nbsp;<input type="text" class="g-input">&nbsp;页&nbsp;<input type="button" onclick="" value="确定" class="btn btn-sm btn-primary"></input></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script src="{{asset('js/plugins/layer/laydate/laydate.js')}}"></script>
    <script src="{{asset('js/plugins/layer/layer.min.js')}}"></script>

    <script>
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
        //查看订单
        $('.check_order').click(function(){
            var url = '/order/details';//前端模板测试
            //var url = '/order/details/' + $(this).attr('data-id');//前端正式
            var title = '订单详情';
            open_page(url, title);//打开新页面
            /*$(window.parent.document).find('.J_menuTabs .page-tabs-content a').removeClass('active');
            $(window.parent.document).find('.J_menuTabs .page-tabs-content').append('<a href="javascript:;" class="J_menuTab active" data-id="'+url+'">'+title+' <i class="fa fa-times-circle"></i></a>');
            // 添加选项卡对应的iframe
            var str1 = '<iframe class="J_iframe" name="iframe' + $(this).attr('data-id') + '" width="100%" height="100%" src="' + url + '" frameborder="0" data-id="' + url + '" seamless></iframe>';
            $(window.parent.document).find('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);*/
        })

        //取消订单
        $('.cancel_order').click(function(){
            var order_id = $(this).attr('data-id');
            layer.confirm('是否取消订单？', {
                btn: ['确认', '取消'] //可以无限个按钮
            }, function (index) {
                $.ajax({
                    url: '',
                    type: 'GET',
                    dataType: 'json',
                    data: {'order_id': order_id},
                    success: function (data) {
                        if (0 == data.code) {
                            layer.alert(data.message, {
                                icon: 1
                            }, function () {
                                location.reload();
                            });
                        } else {
                            layer.alert(data.message, {
                                icon: 2
                            });
                        }
                    }
                });
            }, function (index, layero) {
                layer.close(index);
            });
        })
    </script>
@endsection
